package com.platform.enums;

import com.platform.comm.constants.EnumOption;
import com.platform.comm.enums.IEnumOption;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author liujizheng
 * @version 1.0
 * @ClassName StrategyStatus
 * @Description 执行策略
 * @date 2021/8/18 18:35
 */
@EnumOption(name = "strategyStatus")
public enum StrategyStatus implements IEnumOption<String> {
    /**
     * 增量
     */
    INCREMENT("increment", "增量"),
    /**
     * 全量
     */
    ALL("all", "全量");

    String strategy;
    String title;
    StrategyStatus(String strategy, String title) {
        this.strategy = strategy;
        this.title = title;
    }

    /**
     * 枚举项 “键”
     *
     * @return key
     */
    @Override
    public String key() {
        return strategy;
    }

    /**
     * 枚举项 “值”
     *
     * @return value
     */
    @Override
    public String value() {
        return title;
    }

    /**
     * 枚举options
     *
     * @return
     */
    @Override
    public Map<String, String> enums() {
        return Arrays.stream(values()).collect(Collectors.toMap(IEnumOption::key, IEnumOption::value));
    }
}
